<style lang="less" scoped>
  .acpt-list-body {
    .txt {
      padding-right:0 !important;
    }
  }
  .mb30 {
    &:last-of-type{
      margin: 0;
    }
  }
</style>

<template>
  <div>
    <!-- <div class="m-sech-wrap mr20">
      <router-link :to="{path:'/search',query: { type: 'settle'}}" class="m-sech-box displayflex">
        <i class="iconfont icon-search"></i>
        <div class="flex1 m-sech-ipt">
          <div class="txt">{{sechTxt || '结算单号/供应商名称'}}</div>
        </div>
      </router-link>
    </div> -->

    <scroller lock-x scrollbar-y use-pullup v-if="todolist.length > 0" ref="Scroller" :pullup-config="ScrollerConfig">
      <div class="acpt-list">
        <div class="acpt-list-wrap mb30"  @click="goToDetail(item.settlebillno)" v-for="(item, index) in todolist">
          <div class="acpt-list-head cf">
            <span class="time f-l">结算单号：{{item.settlebillno}}</span>
            <em class="org f-r ft12">{{item.invoicestate === 'I03'?'已结算':'未结算'}}</em>
          </div>
          <div class="displayflex acpt-list-body">
            <i class="iconfont icon-cargo"></i>
            <div class="txt flex1">
              <p>结算金额：￥{{item.amount?item.amount.toFixed(2):'0.00'}}</p>
              <p>结算时间：{{item.settledate | time}}</p>
              <p>结算单位：{{item.medname}}</p>
              <p>结算周期：{{item.begindate | time}} - {{item.enddate | time}}</p>
            </div>
          </div>
        </div>
      </div>
    </scroller>
    
  </div>
</template>

<script>
export default {
  data(){
    return {
      sechTxt: '',
      todolist:[],
      ScrollerConfig:{
        content: '',
        downContent: '',
        height: 0,
        loadingContent: '',
        upContent: '',
      },
    }
  },
  created() {
    this.sechTxt = sessionStorage.getItem('sechtxt');
    this.getData();
  },
  mounted() {

  },
  methods: {
    getData(){
      let query = {
        searchvalue:this.sechTxt,
        settlestate:' ',
      };
      sessionStorage.removeItem('sechtxt');
      this.Ajax.post('wxs/settle/getAllByHos', query).then((res) => {
        if (res.errorCode==0) {
          this.todolist = res.data;
        } else {
          this.Toast({
            message: res.message || '操作异常，请稍后重试',
          });
        };
      });
    },
    goToDetail(settlebillno){
      this.$router.push({
        path: 'settleDetail',
        query:{
          billno: settlebillno,
        }
      })
    }
  },
}
</script>